<template>
    <div>
        {{ title }}
    </div>
    <ul>
        <li v-for="(item, index) of names" :key="index">
            {{ item }}
        </li>
    </ul>
</template>
<!-- attribute -->
<script>
export default {
    data() {
        return {

        }
    },
    // 传数据，从父组件传到子组件，只读
    props: {
        title: {
            type: String,
            // 必选项
            required: true
        },
        names: {
            type: Array,
            default() {
                return ["数组对象用方法default"]
            }
        },
        age: {
            type: Number,
            default: 0
        }

    }
}

</script>

<style lang="scss" scoped></style>